﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AuthorityList.aspx.cs" Inherits="TrainingWorkshop.MVPWebsite.Authority.Views.AuthorityList"
    Title="Authority List" MasterPageFile="~/Shared/DefaultMaster.master" %>

<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
    TagPrefix="pp" %>
<%@ Import Namespace="DataContracts" %>
<asp:Content ID="content" ContentPlaceHolderID="DefaultContent" runat="Server">
    <h1>
        Authority List</h1>
    <asp:Panel ID="SearchAuthorityPanel" runat="server" GroupingText="Search Authority"
        BorderColor="White">
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="White">
            <tr>
                <td align="center" bgcolor="White" valign="middle" width="40" colspan="0" style="height: 25px">
                    AuthorityName
                </td>
                <td align="center" bgcolor="White" valign="middle" width="80" colspan="0" style="height: 25px">
                    <asp:TextBox ID="AuthorityNameTextBox" runat="server" Width="108px"></asp:TextBox>
                </td>
                <td align="center" bgcolor="White" valign="middle" width="40" colspan="0" style="height: 25px">
                    Level
                </td>
                <td align="center" bgcolor="White" valign="middle" width="80" colspan="0" style="height: 25px">
                    <asp:DropDownList ID="LevelDropDownList" runat="server" Width="108px">
                    </asp:DropDownList>
                </td>
                <td align="center" bgcolor="White" valign="middle" width="40" colspan="0" style="height: 25px">
                </td>
                <td align="center" bgcolor="White" valign="middle" width="80" colspan="0" style="height: 25px">
                    <asp:Button ID="SearchButton" runat="server" Text="   Search" OnClick="SearchButton_Click"
                        Style="background-color: Transparent; background-image: url(../images/search.jpg);
                        background-position: left center; background-repeat: no-repeat" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <br />
    <br />
    <pp:ObjectContainerDataSource ID="authorityListObjectContainerDataSource" runat="server"
        DataObjectTypeName="DataContracts.AuthorityDTO" />
    <asp:Panel ID="Panel1" runat="server" GroupingText="Authority List" BorderColor="White">
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="White">
            <tr>
                <td align="center" bgcolor="White" valign="middle" width="120" colspan="0" style="height: 25px">
                    <asp:Button ID="CreateButton" runat="server" Text="Create New Authority" PostBackUrl="~/Authority/CreateNewAuthority.aspx"
                        Style="background-color: Transparent; background-image: url(../images/edit.jpg);
                        background-position: left center; background-repeat: no-repeat" />
                </td>
            </tr>
        </table>
        <br />
        <br />
        <table border="1" cellpadding="0" cellspacing="0">
            <asp:Repeater ID="Reapeater1" runat="server" DataSourceID="authorityListObjectContainerDataSource">
                <HeaderTemplate>
                    <tr>
                        <td align="center" bgcolor="#507CD1" valign="middle" width="180" colspan="0" style="height: 25px">
                            AuthorityName
                        </td>
                        <td align="center" bgcolor="#507CD1" valign="middle" width="80" colspan="0" style="height: 25px">
                            LevelName
                        </td>
                        <td align="center" bgcolor="#507CD1" valign="middle" width="180" colspan="0" style="height: 25px">
                            Management
                        </td>
                    </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td align="center" valign="middle" width="180" colspan="0" style="height: 25px">
                            <%#DataBinder.Eval(Container.DataItem,"AuthorityName") %>
                        </td>
                        <td align="center" valign="middle" width="90" colspan="0" style="height: 25px">
                            <%#DataBinder.Eval(Container.DataItem, "Level.LevelName")%>
                        </td>
                        <td align="center" valign="middle" width="120" colspan="0" style="height: 25px">
                            <asp:Button ID="UpdateButton" runat="server" align="center" CommandArgument='<%#Eval("AuthorityId") %>'
                                OnClick="UpdateButton_Click" Text="Update" />
                            <asp:Button ID="DeleteButton" OnClientClick="javascript:return confirm('Do you want to delete it?');"
                                runat="server" align="center" CommandArgument='<%#Eval("AuthorityId") %>' OnClick="DeleteButton_Click"
                                Text="Delete" />
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
        <br />
    </asp:Panel>
</asp:Content>
